<?php
require_once("classes/db.class.php");
require_once("classes/user.class.php");

require_once 'mysql.config.php';

$db = new DataBase($db_address, $db_username, $db_password, $db_db);

session_start();
if (!isset($_SESSION['uid']))
    header("location: login.php?msg=isnaujo");





if (isset($_GET['id']))
    $id = $_GET['id'];
else
    $id = $_SESSION['uid'];
$db->select("users", "`id`", "id=$id");
$uid = $db->getResult();
$user = new User($uid['id']);
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Hiveme.com</title>
        <meta name="description" content="">
        <meta name="author" content="">

        <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
        <!--[if lt IE 9]>
          <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->

        <!-- Le styles -->
        <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
        <link href="css/boot.css" rel="stylesheet">
        <link rel="stylesheet" href="dev/themes/base/jquery.ui.all.css">
        <link rel="stylesheet" href="master.css">
        <link rel="stylesheet" href="css/buttons.css"/>
        <script src="jquery-1.6.2.js"></script>
        <script src="js/twipsy.js"></script>
        <script src="js/hover.js"></script>
        <script src="dev/ui/jquery.ui.core.js"></script>

        <script src="dev/ui/jquery.ui.widget.js"></script>
        <script src="dev/ui/jquery.ui.datepicker.js"></script>


        <style type="text/css">
            /* Override some defaults */
            html, body {
                background-color: #eee;
            }
            body {
                padding-top: 40px; /* 40px to make the container go all the way to the bottom of the topbar */
            }
            .container > footer p {
                text-align: center; /* center align it with the container */
            }
            .container {
                width: 820px; /* downsize our container to make the content feel a bit tighter and more cohesive. NOTE: this removes two full columns from the grid, meaning you only go to 14 columns and not 16. */
            }

            /* The white background content wrapper */
            .mcontent {
                background-color: #fff;
                padding: 20px;
                margin: 0 -20px; /* negative indent the amount of the padding to maintain the grid system */
                -webkit-border-radius: 0 0 6px 6px;
                -moz-border-radius: 0 0 6px 6px;
                border-radius: 0 0 6px 6px;
                -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.15);
                -moz-box-shadow: 0 1px 2px rgba(0,0,0,.15);
                box-shadow: 0 1px 2px rgba(0,0,0,.15);
            }

            /* Page header tweaks */
            .page-header {
                background-color: #f5f5f5;
                padding: 20px 20px 10px;
                margin: -20px -20px 20px;
            }

            /* Styles you shouldn't keep as they are for displaying this base example only */
            .content .span10,
            .content .span4 {
                min-height: 500px;
            }
            /* Give a quick and non-cross-browser friendly divider */
            .content .span4 {
                margin-left: 0;
                padding-left: 19px;
                border-left: 1px solid #eee;
            }

            .topbar .btn {
                border: 0;
            }

        </style>
    <sscript type="text/javascript" src="jquery-1.2.6.min.js"></script>
    <scrispt src="facebox.js" type="text/javascript"></script>

        <!-- Le fav and touch icons -->
        <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
        <meta name="apple-mobile-web-app-capable" content="yes" />

        <meta name="apple-mobile-web-app-status-bar-style" content="white" />
        <link rel="apple-touch-icon" href="iphon_tetris_icon.png"/>

        <link rel="apple-touch-startup-image" href="hivesplash.png" />
        <script type="text/javascript" src="jquery.countdown.js"></script>
        <script type="text/javascript" src="jquery.countdownt.js"></script>
        <style type="text/css">
            @import "jquery.countdown.css";
        </style>

        <script>
            $(function() {
                //  $('a[rel*=facebox]').facebox({    });
                
                $( "#date" ).datepicker({ dateFormat: 'yy-mm-dd',maxDate:0});
                $('.more').live("click",function() 
                {
                    var ID = $(this).attr("id");
                    var order = $('input#orders'+ID).val();
                    var filter = $('input#filters').val();
                    if(ID)
                    {
                        $("#more"+ID).html('<img src="moreajax.gif" />');
                        //alert(order);
                        $.ajax({
                            type: "POST",
                            url: "asks_more.php",
                            data: "last_ask="+ ID+"&order="+order+"&filter="+filter, 
                            cache: false,
                            success: function(html){
                                $("ol#updates").append(html);
                                $("#more"+ID).remove(); // removing old more button
                            }
                        });
                    }
                    else
                    {
                        $(".morebox").html('No more results');// no results
                    }

                    return false;
                });
                $('.fmore').live("click",function() 
                {
                    var ID = $(this).attr("id");
                    var order = $('input#orders'+ID).val();
                    var filter = $('input#filters').val();
                    if(ID)
                    {
                        $("#fmore"+ID).html('<img src="moreajax.gif" />');
                        //alert(order);
                        $.ajax({
                            type: "POST",
                            url: "feedbacks_more.php",
                            data: "last_ask="+ ID+"&order="+order+"&filter="+filter, 
                            cache: false,
                            success: function(html){
                                $("ol#updates").append(html);
                                $("#fmore"+ID).remove(); // removing old more button
                            }
                        });
                    }
                    else
                    {
                        $(".fmorebox").html('No more results');// no results
                    }

                    return false;
                });
            });
        </script>
        </head>

        <body>
            <div class="topbar">
                <div class="fill">
                    <div class="container">
                        <a class="brand" href="index.php">Hiveme.com</a>
                        <?php

                        function cur($str) {
                            if (isset($_GET['p']))
                                $tmpp = $_GET['p'];
                            else {
                                $tmpp = "";
                            }
                            if ($tmpp == $str)
                                return "class='active'";
                        }
                        ?>
                        <ul class="nav">
                            <li <?php echo cur("") ?>><a href="index.php">Home</a></li>
                            <li <?php echo cur("myasks") ?>><a href="index.php?p=myasks">My asks</a></li>
                            <li <?php echo cur("myfeedbacks") ?>><a href="index.php?p=myfeedbacks">Sent feedbacks</a></li>
                            <li <?php echo cur("logout") ?>><a href="logout.php">Logout</a></li>

                        </ul>
                    </div>
                </div>
            </div>

            <div class="container">
                <div class="mcontent">
                    <div class="page-header">
                        <h1>Hiveme.com <small>Feedback matters</small></h1>
                    </div>
                    <div class="row">
                        <div class="span10">
                            <?
                            if (isset($_GET['p']))
                                $p = $_GET['p'];
                            else
                                $p = "";
                            switch ($p) {
                                default:
                                    include("home.php");
                                    break;
                                case "myasks":
                                    include("myasks.php");
                                    break;
                                case "ask":
                                    include("feedback_ask.php");
                                    break;
                                case "feedbacksent":
                                    include("sendfeedback.php");
                                    break;
                                case "myfeedbacks":
                                    include("my_feedbacks.php");
                                    break;
                                case "gfeedback":
                                    include ("feedback_give.php");
                                    break;
                                case "feedback":
                                    include ("feedback.php");
                                    break;
                                case "fsent":
                                    include ("fsent.php");
                                    break;
                                case "allasks":
                                    include ("feedbacks_rate.php");
                                    break;
                            }
                            ?>

                        </div>          
                        <div class="span4">
                            <?php
                            include("sidebar.php");
                            ?>
                        </div>
                    </div>
                </div>

                <footer>
                    <p>&copy; hiveme.com 2011</p>
                </footer>

            </div> <!-- /container -->

            <script type="text/javascript" src="js/superfish.js"></script>
            <script type="text/javascript" src="js/supersubs.js"></script>
            <script type="text/javascript" src="js/hoverIntent.js"></script>
            <script type="text/javascript" src="js/jquery.flot.js"></script>
            <script type="text/javascript" src="js/jquery.graphtable-0.2.js"></script>
            <script type="text/javascript" src="js/jquery-ui.js"></script> 
            <script type="text/javascript" src="js/customInput.jquery.js"></script>
            <script type="text/javascript" src="js/jquery.tablesorter.js"></script>
            <script type="text/javascript" src="js/jquery.tablesorter.pager.js"></script>
            <script type="text/javascript" src="js/jquery.sparkbox-select.js"></script>
            <script type="text/javascript" src="js/jquery.fancybox-1.3.4.js"></script>
            <script type="text/javascript" src="js/jquery.filestyle.mini.js"></script>
            <script type="text/javascript" src="js/date.js"></script>
            <script type="text/javascript" src="js/jquery.datepicker.js"></script>
            <script type="text/javascript" src="js/jquery.treeview.js"></script>
            <script type="text/javascript" src="js/jquery.tipsy.js"></script>
            <script type="text/javascript" src="js/jquery.wysiwyg.js"></script>
            <script type="text/javascript" src="js/plugins/wysiwyg.rmFormat.js"></script>
            <script type="text/javascript" src="js/controls/wysiwyg.image.js"></script>
            <script type="text/javascript" src="js/controls/wysiwyg.link.js"></script>
            <script type="text/javascript" src="js/controls/wysiwyg.table.js"></script>


        </body>
        </html>
